package org.jeecg.modules.lab.items.temp.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.lab.entrust.entity.LabItemsRecordTarget;
import org.jeecg.modules.lab.items.temp.entity.LabItemsTempTarget;
import org.jeecg.modules.lab.items.temp.mapper.LabItemsTempSampleMapper;
import org.jeecg.modules.lab.items.temp.mapper.LabItemsTempTargetMapper;
import org.jeecg.modules.lab.items.temp.service.ILabItemsTempTargetService;
import org.jeecg.modules.lab.items.vo.LabRecordTarg;
import org.jeecg.modules.lab.items.vo.LabTempTarg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 实验项目模板_检测信息
 * @Author: jeecg-boot
 * @Date:   2023-10-08
 * @Version: V1.0
 */
@Service
public class LabItemsTempTargetServiceImpl extends ServiceImpl<LabItemsTempTargetMapper, LabItemsTempTarget> implements ILabItemsTempTargetService {
    @Autowired
    private LabItemsTempTargetMapper labItemsTempTargetMapper;


    @Override
    public List<LabTempTarg> handTempData(String itemId) {
        List<LabTempTarg> tempTargList = labItemsTempTargetMapper.getTempTargList( itemId);
        QueryWrapper<LabItemsTempTarget> queryWrapper = new QueryWrapper<>();
        for (LabTempTarg labTempTarg : tempTargList) {
            queryWrapper.clear();
            queryWrapper.eq("field_row", labTempTarg.getTId())
                    .eq("item_id", itemId)
                    .orderByAsc("field_sort");
            List<LabItemsTempTarget> itemsRecordTargetList = labItemsTempTargetMapper.selectList(queryWrapper);
            labTempTarg.setLabItemsTempTargetList(itemsRecordTargetList);
        }
        return tempTargList;
    }
}
